﻿@using BonjourQuotation.UI.Models.PartialModel
@using MvcCheckBoxList
@model OperationAttrBusConfirmationViewModel
@{
    Layout = null;
}
<script type="text/javascript">
    // Save AttrBusConfirm Data
    function AttrBusConfirmGridSave() {
        var OperationAttrBusConfirmationViewModel = {
            AttrBusConfArrivalDate: $("#AttrBusConfArrivalDate").val(),
            AttrBusConfArrivalTime: $("#AttrBusConfArrivalTime").val(),
            AttrBusConfSelectedStatus: $("#AttrBusConfSelectedStatus").val(),
            AttrBusConfGroupID: $("#AttrBusConfGroupID").val(),
            AttrBusConfVendorID: $("#AttrBusConfVendorID").val(),
            AttrBusConfNote: $("#AttrBusConfNote").val(),
            AttrBusVendorType: $("#AttrBusVendorType").val(),
        };

        var DTO = JSON.stringify(OperationAttrBusConfirmationViewModel);

        $.ajax({
            url: urls["OperationAttrBusConfirmGridSave"],
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            data: DTO,
            success: function (data) {
                $("#tabConfirmation").html(data);
            },
            error: function (xhr) {
                //   alert('Error: ' + xhr.statusText);
            },
            complete: function () {
                switch ($("#AttrBusVendorType").val()) {
                    case "Bus":
                        {
                            OperGroupBusConfLoad($("#AttrBusConfGroupID").val(), $("#AttrBusConfVendorID").val(), $("#AttrBusConfArrivalDate").val(), $("#AttrBusVendorType").val());
                            LoadBusGridByGroupCode($("#AttrBusConfGroupCode").val());
                        }
                        break;
                    case "Attractions":
                        {
                            OperGroupAttractionsConfLoad($("#AttrBusConfGroupID").val(), $("#AttrBusConfVendorID").val(), $("#AttrBusConfArrivalDate").val(), $("#AttrBusVendorType").val());
                            LoadAttractionsGridByGroupCode($("#AttrBusConfGroupCode").val());
                        }
                        break;
                    case "Restaurants":
                        {
                            OperGroupAttractionsConfLoad($("#AttrBusConfGroupID").val(), $("#AttrBusConfVendorID").val(), $("#AttrBusConfArrivalDate").val(), $("#AttrBusVendorType").val());
                            LoadAttractionsGridByGroupCode($("#AttrBusConfGroupCode").val());
                        }
                        break;
                    default:
                        {
                            OperGroupAttractionsConfLoad($("#AttrBusConfGroupID").val(), $("#AttrBusConfVendorID").val(), $("#AttrBusConfArrivalDate").val(), $("#AttrBusVendorType").val());
                            LoadAttractionsGridByGroupCode($("#AttrBusConfGroupCode").val());
                        }
                        break;
                }
            }
        });
    }
    // AttrBus Conf details changed
    $(document).on('change', '.AttrBusConfDetData', function () {
        if (!$("#operAttrBusConfsavebtn").hasClass("GridDataChanged"))
            $("#operAttrBusConfsavebtn").addClass("GridDataChanged");
    });
</script>

@using (Ajax.BeginForm("SaveOperationAttrBusConfirmationData", "Operation", new AjaxOptions() { HttpMethod = "Post", UpdateTargetId = "tabConfirmation", InsertionMode = InsertionMode.Replace }, new { enctype = "multipart/form-data", id = "OperAttrBusConfirmationForm" }))
{
    <div class="OperationTabsTitleDiv">
        @Html.LabelForModel(Model.AttrBusConfVendorName, new { @class = "OperationTabsTitle" })
        @if (Model.AttrBusVendorType == "Attractions")
        { 
            <label class="OperationTabsTitleConfrims">Attraction</label>
        }
        else if (Model.AttrBusVendorType == "Restaurants")
        { 
            <label class="OperationTabsTitleConfrims">Restaurant</label>
        }
        else
        { 
            @Html.LabelForModel(Model.AttrBusVendorType, new { @id = "VendorTypeText", @class = "OperationTabsTitleConfrims" })
        }
    </div>
    @Html.HiddenFor(model => model.AttrBusConfGroupID)
    @Html.HiddenFor(model => model.AttrBusConfGroupCode)
    @Html.HiddenFor(model => model.AttrBusConfVendorID)
    @Html.HiddenFor(model => model.AttrBusVendorType)
    <div style="height: 100px; width: 1172px; background-color: rgba(128, 128, 128, 0.8);">
        <div class="pull-right" style="margin-left:25px; margin-bottom:15px;">

            <div class="row form-row">
                <div class="ElementsPaddingRight30 col-lg-2" style="width:25% !important;">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.AttrBusConfArrivalDate)</span>
                        @Html.TextBoxFor(model => model.AttrBusConfArrivalDate, new { @class = "table_inputs_SmallPadding2 inpputgr form-control", @readonly = true })
                    </div>
                </div>
                <div class="ElementsPaddingRight30 col-lg-1">
                    @Html.TextBoxFor(model => model.AttrBusConfArrivalTime, new { @class = "table_inputs_SmallPadding2 inpputgr form-control VendConfCalendarTime AttrBusConfDetData" })
                </div>
                <div class="ElementsPaddingRight30 col-lg-3" style="width:27.4% !important;">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.AttrBusConfStatus)</span>
                        @Html.DropDownListFor(x => x.AttrBusConfSelectedStatus, new SelectList(Model.AttrBusConfStatus, "Value", "Text"), new { @class = "table_inputs_SmallPadding2 inpputgr form-control AttrBusConfDetData" })
                    </div>
                </div>
                <div class="ElementsPaddingRight30 col-lg-6" style="width:38.4% !important;">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.AttrBusConfNote)</span>
                        @Html.TextBoxFor(model => model.AttrBusConfNote, new { @class = "table_inputs_SmallPadding2 inpputgr form-control AttrBusConfDetData" })
                    </div>
                </div>
            </div>
            <div class="row form-row">
                <div class="ElementsPaddingRight30 col-lg-1" style="width:8% !important">
                    <div class="input-group">
                        <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">All:</span>
                        <input type="checkbox" class="table_inputs_checkbox" style="margin-left: -2px;" name="UpdateAllContracts" id="UpdateAllContracts">
                    </div>
                </div>
                <div class="ElementsPaddingRight30 col-lg-5" style="height: 24px;">
                    <div class="input-group">
                        <input type="file" id="UploadAttrBusConfirmFilePath" name="UploadAttrBusConfirmFilePath" style="width: 300px;margin-top: 2%;">
                        <input type="button" id="AttrBusStartUpload" class="btn14 btn120" value="Upload File to Server" style="margin-left: 100%;margin-top: -8%;width: 150px;float: left;">
                    </div>
                </div>
                @if (Model.AttrBusConfirmFile != null)
                {
                    <div class="ElementsPaddingRight30 col-lg-7" id="AttrBusDownloadDiv" style="width:50.3% !important">
                        <div class="pull-left">
                            @Html.TextBoxFor(model => model.AttrBusConfirmFile, new { @style = "Display:None", @id = "AttrBusConfirmFileHidden" })
                            @Html.LabelForModel(Model.AttrBusConfirmFile.Split('/').Last())
                        </div>
                        <div class="input-group pull-right" style="margin-right:12px;">
                            <input type="button" class="btn14 btn120" id="AttrBusDownload" value="Download File">
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
    <div style="padding-top:10px;float:right">
        <button class="btn14 btn60 pull-right" id="operAttrBusConfsavebtn" onclick="AttrBusConfirmGridSave()" type="button">Save</button>
    </div>

}





